package com.example.shop_car_2208.db

import android.content.Context
import androidx.room.Room
import java.security.AccessControlContext

/**
 * 数据库工具类
 */
class MyDBUtils {
    companion object{
        private lateinit var myDataBase: MyDataBase
        fun init(context: Context){
            myDataBase = Room.databaseBuilder(context, MyDataBase::class.java,"2208.db")
                .allowMainThreadQueries()//允许主线程访问
                .build()
        }
        //对外暴露一个数据库
        fun getDB() = myDataBase
    }
}